package com.tjoydoorsystem;

import android.os.Environment;

/**
 * Author：hebin on 2016/10/27 0027
 * <p>
 * Annotations：存放全局变量值
 */
public class Global {

    /**
     * 常量
     */
    public static class Const {

        /**
         * 蓝牙常量
         */
        public final static int REQUEST_ENABLE_BT = 1;
        public final static long SCAN_PERIOD = 10000; //十秒钟扫描
        public final static String MAC = "04:A3:16:A7:0D:93";    //继电器物理地址
        //        public final static String MAC = "88:C2:55:2E:7C:7F";    //继电器物理地址 test

        /**
         * 注意下面的时间根据不同的设备会用不同感官效果  影响大
         */
        public final static int timeFaceCheck = 3000;         //是否有人脸检测器
        public final static int timeMsgDisplay = 6000;        //信息展示时间
        public final static int PermissionCallBack = 5;           //权限回调
        public final static int PermissionSetting = 6;            //权限设置界面
        public final static int cameraId = 1;
        public final static int detectSize = 80;
        public final static double recognitionRate = 0.92;        //识别率

        //网络监听过滤器
        public final static String reConnect = "com.tjdoorsystem.connect";

        public final static String companyUser = "contact@zhthinkjoy.com";   //企业账号
        //        public final static String companyUser = "13631284436@163.com";   //企业账号
        public final static String companyPW = "123456";                     //企业密码

        /**
         * sp数据常量  key值
         */

        public final static String companyInfo = "companyInfo";
        public final static String staffInfo = "staffInfo";
        public final static String daKaInfo = "daKaInfo";
        public final static String isFirstInApp = "isFirstInApp";
        public final static String appStartTime = "appStartTime";


        //蓝牙继电器特征命令
        public final static byte[] WRITE_OPEN_01 = new byte[8];
        public final static byte[] WRITE_CLOSE_01 = new byte[8];
        public final static byte[] WRITE_OPEN_02 = new byte[8];
        public final static byte[] WRITE_CLOSE_02 = new byte[8];
        public final static byte[] WRITE_ALLOPEN = new byte[8];
        public final static byte[] WRITE_ALLCLOSE = new byte[8];

        static {
            WRITE_OPEN_01[0] = 0x33;
            WRITE_OPEN_01[1] = 0x01;
            WRITE_OPEN_01[2] = 0x12;
            WRITE_OPEN_01[3] = 0x00;
            WRITE_OPEN_01[4] = 0x00;
            WRITE_OPEN_01[5] = 0x00;
            WRITE_OPEN_01[6] = 0x01;
            WRITE_OPEN_01[7] = 0x47;

            WRITE_CLOSE_01[0] = 0x33;
            WRITE_CLOSE_01[1] = 0x01;
            WRITE_CLOSE_01[2] = 0x11;
            WRITE_CLOSE_01[3] = 0x00;
            WRITE_CLOSE_01[4] = 0x00;
            WRITE_CLOSE_01[5] = 0x00;
            WRITE_CLOSE_01[6] = 0x01;
            WRITE_CLOSE_01[7] = 0x46;

            WRITE_OPEN_02[0] = 0x33;
            WRITE_OPEN_02[1] = 0x01;
            WRITE_OPEN_02[2] = 0x12;
            WRITE_OPEN_02[3] = 0x00;
            WRITE_OPEN_02[4] = 0x00;
            WRITE_OPEN_02[5] = 0x00;
            WRITE_OPEN_02[6] = 0x02;
            WRITE_OPEN_02[7] = 0x48;

            WRITE_CLOSE_02[0] = 0x33;
            WRITE_CLOSE_02[1] = 0x01;
            WRITE_CLOSE_02[2] = 0x11;
            WRITE_CLOSE_02[3] = 0x00;
            WRITE_CLOSE_02[4] = 0x00;
            WRITE_CLOSE_02[5] = 0x00;
            WRITE_CLOSE_02[6] = 0x02;
            WRITE_CLOSE_02[7] = 0x47;

            WRITE_ALLOPEN[0] = 0x33;
            WRITE_ALLOPEN[1] = 0x01;
            WRITE_ALLOPEN[2] = 0x14;
            WRITE_ALLOPEN[3] = 0x00;
            WRITE_ALLOPEN[4] = 0x00;
            WRITE_ALLOPEN[5] = 0x00;
            WRITE_ALLOPEN[6] = 0x00;
            WRITE_ALLOPEN[7] = 0x48;

            WRITE_ALLCLOSE[0] = 0x33;
            WRITE_ALLCLOSE[1] = 0x01;
            WRITE_ALLCLOSE[2] = 0x13;
            WRITE_ALLCLOSE[3] = 0x00;
            WRITE_ALLCLOSE[4] = 0x00;
            WRITE_ALLCLOSE[5] = 0x00;
            WRITE_ALLCLOSE[6] = 0x00;
            WRITE_ALLCLOSE[7] = 0x47;

        }
    }

    /**
     * 变量
     */

    public static class Varibale {

        public static boolean isSuccess;          //展示成功界面还是失败界面
        public static boolean isFirst = true;
        public static boolean isSaveAndroidDealTime = true;
        public static boolean isSaveHttpRequestTime = true;

        public static double confidence;  //用于传递对比结果相似度
        public static double httpTime;    //用于传递http请求到响应时间


        public static int postCount = 0;
        public static int saveAndroidDealTimeCount = 0;
        public static int saveHttpRequestTimeCount = 0;


        public static String compareName = ""; //用于传递对比结果名字
        public static String lastName = ""; //用于记录上一个人名字
        public static String successName; //用于信息展示本地判断   拿的是最后一次成功时的名字作为判断依据
        public static String age = "";
        public static String gender_woman = "";
        public static String gender_man = "";
    }

    /**
     * URL地址
     */
    public static class UrlPath {
        /**
         * HTTP接口
         */
        public static String MANAGER = "http://120.25.235.44:8080/appmanage";                //APP管理系统地址
        public static String PostError = MANAGER + "/app/appErrorInfo/add";                  //错误日志（本地）


        //        public static String ROOTPATH =" http://192.168.0.70:8086/platform-api/";
        //        public static String ROOTPATH = "http://192.168.0.223:8085/door/api/";
        public static String ROOTPATH = "http://112.74.101.131:8780/door/api/";
        public static String login = ROOTPATH + "login";
        public static String checkWork = ROOTPATH + "checkWork";
        public static String getEmployee = ROOTPATH + "getEmployee";


    }

    /**
     * 文件路径地址
     */
    public static class FilePath {
        public final static boolean HASSDCARD = Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);
        public final static String SDCARDPATH = Environment.getExternalStorageDirectory().getAbsolutePath();
        public final static String APPPATH = HASSDCARD ? SDCARDPATH + "/thinkjoy/doorsecurity" : "/data/data/cn.doorsecurity/files";
        public final static String AppCrash = APPPATH + "/crash";  //异常捕捉文件存储类
        public final static String PIC = APPPATH + "/pic";
        public final static String AppDown = APPPATH + "/down";

        /**
         * 保存数据文件名
         */
        public final static String httpTime = "httpTime.txt";
        public final static String compareResult = "compareResult.txt";
        public final static String bmpSize = "bmpSize.txt";
        public final static String androidDealTime = "androidDealTime.txt";
    }
}
